import { userComment, userDetail } from "../../api/user";
const WxParse = require('../../utils/wxParse/wxParse/wxParse')
Page({
  data: {
    detail: {},
    html: '',
    id: null,
    data: {
      type: 'a',
      source: null,
      limit: 999
    },
    comment: {}
  },
  async onLoad(options) {
    // console.log(options);
    // this.setData({
    //   id: options.id
    // })
    const res = await userDetail(options.id)
    console.log(res);

    this.setData({
      detail: res.data,
      'data.source': options.id,
      html: res.data.content.replace(/\<img/gi, '<img class="rich-imgs" ')
    })
    const detail = res.data
    const content = detail.content.replace(/\<img/gi, '<image ')
    WxParse.wxParse('content','html',detail.content,this,5)
    const res1 = await userComment(this.data.data)
    console.log(res1);
    this.setData({
      comment: res1.data
    })
  },
  onClickLeft() {
    wx.navigateBack()
  }
})